from selenium import  webdriver
import time
from selenium.webdriver.common.by import By
import numpy
import random
number='asd12345678'

# driver = webdriver.Chrome(r'D:\bianchengerbianchenger\driver\chromedriver.exe')
# driver.get('http://47.107.178.45/phpwind/')
# driver.maximize_window()
#
# driver.find_element(By.LINK_TEXT,"立即注册").click()
#
# driver.find_element(By.ID,'J_reg_username').send_keys(number)
# driver.find_element(By.ID,'J_reg_password').send_keys(number)
# driver.find_element(By.ID,'J_reg_repassword').send_keys(number)
# driver.find_element(By.ID,'J_reg_email').send_keys(number+'@qq.com')
#
# driver.find_element(By.CLASS_NAME,"btn.btn_big.btn_submit.mr20").click()
# time.sleep(2)
# driver.quit()


driver = webdriver.Chrome(r'D:\bianchengerbianchenger\driver\chromedriver.exe')
driver.get('http://47.107.178.45/phpwind/')

driver.maximize_window()

driver.find_element(By.ID,'J_username').send_keys(number)
driver.find_element(By.ID,'J_password').send_keys(number)

driver.find_element(By.CLASS_NAME,"btn.btn_big.btn_submit").click()

time.sleep(2)

driver.find_element(By.CLASS_NAME,'header_post').click()

# driver.find_element(By.XPATH,'/html/body/div/header/div/div[3]/div[2]/div/ul/li').click()
time.sleep(2)
driver.find_element(By.XPATH,'//li[@role="option" and @data-cid="11"]').click()

time.sleep(2)





driver.find_element(By.CLASS_NAME,'J_forum_item').click()
time.sleep(2)
driver.find_element(By.CLASS_NAME,'btn.btn_submit').click()

i=numpy.random.randint(1,1000)

driver.find_element(By.ID,'J_atc_title').send_keys('中分头背带裤我是ikun你记住'+i)
time.sleep(2)
#切换框架
f = driver.find_element(By.CLASS_NAME,'wind_editor_iframe')
driver.switch_to.frame(f)       #切入框架

driver.find_element(By.CLASS_NAME,'editor_content').send_keys('中分头背带裤我是ikun你记住')

driver.switch_to.default_content()      #切出框架

driver.find_element(By.CLASS_NAME,'btn.btn_submit.btn_big.fl.mr10').click()




